package com.jiazhong.oop;

import java.util.Scanner;

public class Math {
    String name;
    String speak;
    public void setSpeak(){
        name="牛顿";
        speak="数学简单";
        System.out.println(name+"说"+speak);
    }
    public int getSum(){//1-n的和
        int n,sum=0;
        Scanner sc=new Scanner(System.in);
        System.out.println("前n项数之和,n:");
        n=sc.nextInt();
        for (int i=1;i<=n;i++){
            sum+=i;
        }
        return sum;
    }
    public int getMul(int sum1,int sum2){//sum1,sum2的乘积
        int mul;
        mul=sum1*sum2;
        return mul;
    }
}
